package edu.ustb.efws.base.controller.form;

import edu.ustb.efws.base.domain.Detector;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;


@ApiModel("新增设备")
public class DetectorSaveForm {
    @NotBlank
    @ApiModelProperty(value = "传感器类型", required = true)
    private String detectorType;
    @NotBlank
    @ApiModelProperty(value = "名称", required = true)
    private String description;
    @ApiModelProperty(value = "位置")
    private String location;
    @NotBlank
    @Size(max=20)
    @ApiModelProperty(value = "采集数据表名", required = true)
    private String tableName;
    @ApiModelProperty(value = "是否采集数据", required = true)
    @NotNull
    private Boolean collect = true;

    public String getDetectorType() {
        return detectorType;
    }

    public void setDetectorType(String detectorType) {
        this.detectorType = detectorType;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    public Boolean getCollect() {
        return collect;
    }

    public void setCollect(Boolean collect) {
        this.collect = collect;
    }

    public Detector toDomain(){
        Detector t = new Detector();

        t.setDetectorType(detectorType);
        t.setDescription(description);
        t.setLocation(location);
        t.setTableName(tableName);
        t.setCollect(collect);

        return t;
    }
}
